package com.ym.core.utils;

import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

public class MultipartFileUtil {
    public static void copyFile(MultipartFile sourceFile, String destPath) throws IOException {
        File targetDir = new File(destPath);
        File targetFile = new File(destPath, sourceFile.getOriginalFilename());
        if (!targetDir.exists()) {
            targetDir.mkdirs();
        }
        sourceFile.transferTo(targetFile);
    }
}
